package com.appbee.cm.server.data;

import com.appbee.core.server.dao.BaseDAO;
import com.google.appengine.api.datastore.Query.FilterOperator;
import com.google.appengine.api.datastore.QueryResultIterator;
import com.google.appengine.repackaged.com.google.common.collect.Lists;
import com.google.code.twig.FindCommand.RootFindCommand;

public class ActivityEntryDAO extends BaseDAO<ActivityEntry>
{

	public void deleteByNavItemId(Long id)
	{
		RootFindCommand<ActivityEntry> findCommand = objectDatastore.find()
				.type(ActivityEntry.class);
		findCommand.addFilter("navItemId", FilterOperator.EQUAL, id);
		QueryResultIterator<ActivityEntry> result = findCommand.now();
		objectDatastore.deleteAll(Lists.newArrayList(result));
	}

}
